#include "RecieveRoleAssignmentState.h"
#include "World.h"
#include "AttackingState.h"
#include "DefendingState.h"
#include "DecoyState.h"

bool RecieveRoleAssignmentState::decoy_assigned = false;
int RecieveRoleAssignmentState::defending_agents = 0;
int RecieveRoleAssignmentState::attacking_agents = 0;
double RecieveRoleAssignmentState::defending_bias = 1.0;

RecieveRoleAssignmentState::RecieveRoleAssignmentState(void)
{
}


RecieveRoleAssignmentState::~RecieveRoleAssignmentState(void)
{
}

Command RecieveRoleAssignmentState::GetCommand(Agent* agent) {
	/*
	if (!decoy_assigned) {
		decoy_assigned = true;
		agent->setState(new DecoyState());
	}
	else if (DecoyState::in_position) {*/
		if (defending_agents < (defending_bias * World::instance()->tanks().size())) {
			agent->setState(new DefendingState(), false);
			defending_agents++;
		}
		else {
			agent->setState(new AttackingState());
			attacking_agents++;
		}
		/*
	}
	else {
		return Command(agent->getTank()->index, .3, 1, false);
	}*/

	return agent->GetCommand();
}
